//
//  func_demo.cpp
//  cpp_learn
//
//  Created by 李贺 on 2021/12/17.
//

#include "func_demo.hpp"

namespace func_demo {

int what_is_your_height(int height) {
    cout << height << endl;
    return height;
}


string what_is_your_name(string name) {
    cout << name << endl;
    return name;
}

int add_sum(int a, int b) {
    return a + b;
}

typedef decltype(what_is_your_height) Func1;
typedef string Func2(string);


typedef string (*Func3)(string);
typedef decltype(what_is_your_height) (*Func4);

using Func5 = int(int, int);
using Func6 = int(*)(int, int);



Func1 *fff;
Func2 *ddd;
Func3 ccc;
Func4 aaa;
Func5 *add;
Func6 some;

void test_func() {
    fff = what_is_your_height;
    fff(999);
    ddd = what_is_your_name;
    ddd("lili");
    
    ccc = what_is_your_name;
    ccc("hanmeimei");
    
    aaa = what_is_your_height;
    aaa(6666);
    
    add = add_sum;
    cout << add(2,3) << endl;
    
    some = add;
    cout << some(88,22) << endl;
}
}
